package com.laihuichuxing.mq.consumerRocket;

import com.laihuichuxing.order.handle.DriverHandler4Mongo;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.starter.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.starter.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;


/**
 * Description:
 *
 * @author: Qinxuefeng
 * @since: 1.0
 * Create Date Time: 2018/10/26 14:29
 * Update Date Time:
 */
@Slf4j
@Service
@RocketMQMessageListener(topic = "driverCancelTopic", consumerGroup = "${spring.rocketmq.driverCancelGroup}")
public class DriverCancelRConsumer implements RocketMQListener<Map> {
    @Autowired
    private DriverHandler4Mongo driverHandle;

    @Override
    public void onMessage(Map map) {
        try {
            driverHandle.shutdown(map.get("phone").toString(),map.get("cityZone").toString());
        } catch (Exception e) {
            log.error("用户取消订单异常:{}",e.toString(),e);
        }
    }
}